package july2;

import java.util.Arrays;

public class Test05 {
    public static void main(String[] args) {
        Test05Class gf1 = new Test05Class("小培", 22, 170);
        Test05Class gf2 = new Test05Class("小玲", 23, 160);
        Test05Class gf3 = new Test05Class("小湘", 23, 163);

        Test05Class[] arr={gf1,gf2,gf3};

        //利用Arrays中的sort方法进行排序
        Arrays.sort(arr, ( o1,  o2)-> {
                int temp=o1.getAge()-o2.getAge();
                temp=temp==0?o1.getHeight()-o2.getHeight():temp;
                temp = temp == 0 ? o1.getName().compareTo(o2.getName()) : temp;

            return Integer.compare(temp, 0);

        });

        System.out.println(Arrays.toString(arr));

    }
}
